En este apartado se pueden añadir comentarios para explicar el
dashboard.Hemos aprendido a dar formato al texto que se incluya aquí.
Por ejemplo:
1. Negrita 2.CURSIVA
También hemos aprendido que se pueden añadir comentarios sin título, como en este ejemplo. Para ello hay que usar el atributo {.no-title}.
---
title: "TAREA 4 CURSO DASHBOARD"
author: "Rocío Cuberos"
date: "21.Mayo.2025"
output:
flexdashboard::flex_dashboard:
source_code: embed
social: ["facebook", "twitter"]
navbar:
- {title: "web UCM", href: "https://www.ucm.es/", align: left}
orientation: columns
vertical_layout: scroll
---
```{r setup, include=FALSE}
library(flexdashboard)
library(readr)
library(dplyr)
library(ggplot2)
library(DT)
library(plotly)
df <- read_delim("datos_tarea4.csv",
delim = ";", escape_double = FALSE, trim_ws = TRUE)
View(df)
df$L1 <- factor(df$L1)
levels(df$L1)[levels(df$L1) == "1"] <- "Aprendices"
levels(df$L1)[levels(df$L1) == "2"] <- "Nativos"
names(df)[1] <- "ID"
names(df)[2] <- "Grupo"
names(df)[3] <- "Palabras_Argumentativo"
names(df)[4] <- "Palabras_Narrativo"
df_2 <- df[, -c(5,6,7,8,9,10)]
df_2$Palabras_total <- df_2$Palabras_Argumentativo + df_2$Palabras_Narrativo
df_3_A <- select(df_2, ID, Grupo, Palabras_Argumentativo)
df_3_N <- select(df_2, ID, Grupo, Palabras_Narrativo)
colnames(df_3_A)[3] <- "TOTAL_PALABRAS"
colnames(df_3_N)[3] <- "TOTAL_PALABRAS"
nrow(df_3_A)
rep('Argumentativo', times = nrow(df_3_A))
nrow(df_3_N)
rep('Narrativo', times = nrow(df_3_N))
df_3_A$GENERO <- rep('Argumentativo', times = nrow(df_3_A))
df_3_N$GENERO <- rep('Narrativo', times = nrow(df_3_N))
df_4 <- bind_rows(df_3_A, df_3_N)
```
# Página 1 {data-icon=fa-bars}
## Columna
### Componente tabla interactiva
```{r}
tabla_interactiva <- datatable(df_2)
tabla_interactiva
```
### Componente ggplot
```{r}
ggplot(df_4) +
geom_boxplot(aes(x = Grupo, y = TOTAL_PALABRAS, fill = GENERO)) +
labs(title = "Distribución del n. palabras por género en aprendices y nativos",
subtitle = "Gráfico de cajas",
x ="",
y = "Número de palabras \n") +
theme(axis.text.x = element_text(size = 10),
legend.position = "right",
) +
theme_minimal() +
scale_x_discrete(position = "bottom")
```
# Página 2 {data-icon=fa-file}
## Columna
### Componente ggplot dinámico
```{r}
g1 <- ggplot(df_4, aes(x = GENERO, y = TOTAL_PALABRAS, fill = Grupo)) +
geom_bar(stat = "identity", position = "dodge") +
labs(title = "Total de palabras",
x = "GÉNERO",
y = "Total")
g2 <- ggplotly(g1)
g2
```
### Cuadro de texto con comentarios
En este apartado se pueden añadir comentarios para explicar el dashboard.Hemos aprendido a dar formato al texto que se incluya aquí. Por ejemplo:
1. __Negrita__
2.*CURSIVA*
### Cuadro de texto sin título {.no-title}
También hemos aprendido que se pueden añadir comentarios sin título, como en este ejemplo. Para ello hay que usar el atributo {.no-title}.